let user1 = {
    firstName: "John",
};

let user2 = null;

let key = "firstName";

// 使用 ?.[] 来访问可能不存在的属性

alert(user1?.[key]);

alert(user2?.[key]);

alert(user1?.[key]?.something?.not?.existing);

delete user?.name;